﻿/// Copyright (c) Microsoft Corporation.  All rights reserved.
using System;
using System.Runtime.InteropServices;
using Microsoft.VisualStudio.Shell;
using System.ComponentModel;
using System.Windows.Forms;

namespace Tcvt.Packages
{
    [Guid(GuidList.guidTfsBuggerVSPackageOptionsString)]
    public class Options : DialogPage
    {
        private string _tfsHostUrl = "";
        [Category("Server")]
        [DisplayName("TFS Host")]
        [DefaultValue("")]
        [Description("The Team Foundation Server host name. e.g. tkbgitvstfat01.")]
        public string TfsHostUri
        {
            get
            {
                return _tfsHostUrl;
            }
            set
            {
                _tfsHostUrl = value;
            }
        }

        [Category("Server")]
        [DisplayName("Registered TFS Hosts")]
        [ReadOnly(true)]
        [DefaultValue("")]
        [Description("The Team Foundation Server hosts that are currently registered under the current user profile. " +
            "Those are typically TFS instances that have been accessed before from this user profile.")]
        public string RegisteredTfsServers
        {
            get
            {
                string[] regsiteredServers = Utils.RegisteredTfsServers();

                if (regsiteredServers == null || regsiteredServers.Length <= 0)
                    return string.Empty;

                return string.Join(", ", regsiteredServers);
            }
            set {}
        }

        private string _buildDefinitionsTeamProjectName = "";
        [Category("Server")]
        [DisplayName("Builds Project Name")]
        [DefaultValue("")]
        [Description("The Team Project from which the build definitions should be read. " +
            "This is typically also the team project where the source code is located.")]
        public string BuildDefinitionsTeamProjectName
        {
            get
            {
                return _buildDefinitionsTeamProjectName;
            }
            set
            {
                _buildDefinitionsTeamProjectName = value;
            }
        }

        private string _buddyBuildDefinitionName = "";
        [Category("Server")]
        [DisplayName("Default Buddy Build Definition Name")]
        [DefaultValue("")]
        [Description("The name of the build definition to be used to run buddy builds. " +
            "The value specified here becomes the default value in the build defintions drop down.")]
        public string BuddyBuildDefinitionName
        {
            get
            {
                return _buddyBuildDefinitionName;
            }
            set
            {
                _buddyBuildDefinitionName = value;
            }
        }

        private string _defaultDropLocation = "";
        [Category("Server")]
        [DisplayName("Default Drop Location")]
        [DefaultValue("")]
        [Description("The UNC that specifies the default location to be used for copying the build " +
            "output files and the build logs. Make sure that the build service account has write access " +
            "to that location. Leave empty to use the drop location configured for the build definition. " +
            "Example: \\\\drop-server1\\Drops")]
        public string DefaultDropLocation
        {
            get
            {
                return _defaultDropLocation;
            }
            set
            {
                _defaultDropLocation = value;
            }
        }
    }
}
